package com.design.yjx.singleton;

/**
 * @author yuanjianxin
 * @date 2017/8/3 18:27
 * 双重检查加锁，降低由于线程同步造成的效率下降
 */
public class Student {
    private volatile static Student student;

    private Student() {
    }

    public static Student getInstance() {
        if (student == null) {
            synchronized (Student.class) {
                if (student == null) {
                    student = new Student();
                }
            }
        }
        return student;
    }
}
